package com.mall.dubbo.api;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mall.dubbo.mapper.UmsMemberLevelMapper;
import com.mall.model.domain.UmsMemberLevel;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
 * @author xyiaao
 * @description 针对表【ums_member_level(会员等级表)】的数据库操作Api实现
 * @createDate 2022-03-29 19:46:09
 */
@DubboService
public class UmsMemberLevelApiImpl extends ServiceImpl<UmsMemberLevelMapper, UmsMemberLevel>
        implements UmsMemberLevelApi {

    @Autowired
    private UmsMemberLevelMapper memberLevelMapper;

    @Override
    public List<UmsMemberLevel> listByDefault(Integer defaultStatus) {

        LambdaQueryWrapper<UmsMemberLevel> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(defaultStatus != null, UmsMemberLevel::getDefaultStatus, defaultStatus);

        List<UmsMemberLevel> memberLevelList = memberLevelMapper.selectList(queryWrapper);
        return memberLevelList;
    }

}




